﻿using System.Windows.Forms;
using System.Diagnostics;

namespace FileExplorerNet.Demo
{
    public partial class FileExplorerNetDemo : Form
    {
        public FileExplorerNetDemo()
        {
            InitializeComponent();
            fileExplorerNet1.Dock = DockStyle.Fill;

            fileExplorerNet1.OpenFileDelegate = new OpenFileDelegate(OpenFile);
            fileExplorerNet1.Load(); // This method must be called by the user
        }

        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            fileExplorerNet1.SaveFavourites();

            base.OnFormClosing(e);
        }

        public void OpenFile(string path)
        {
            MessageBox.Show("Overriding the default OpenFile function of FileExplorer.NET");
            Process.Start(path);
        }
    }
}
